#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <cassert>

using namespace std;
using lint = long long;
using ldb = double; 

const int N = 1e6 + 7;

#define lowbit(i) ((i) & -(i))
class BIT {
private:
    lint b[N];
public:
    inline void update(int i, int x) {
        for (; i < N; i += lowbit(i))
            b[i] += x;
    }

    inline lint query(lint i) const {
        lint r = 0;

        for (; i; i ^= lowbit(i))
            r += b[i];

        return r;
    }

    inline int findBreak() const {
        lint x = 0, tmp = 0;

        for (int w = 1 << 20; w; w >>= 1) {
            if (x + w < N && tmp + b[x + w] < 0)
                tmp += b[x += w];
        }

        return x;
    }
} siz, sum;

int cnt = 0;
ldb val[N];

lint A[N], B[N];

struct Ques {
	int op, i;
} qs[N];

int main() {
	freopen("love.in", "r", stdin);
	freopen("love.out", "w", stdout);
    cin.tie(0)->sync_with_stdio(false);

    int n;
    cin >> n;

	int idx = 0, op; 
    for (lint t, f, b, i = 1; i <= n; ++i) {
    	cin >> op;
    	if (op == 1) {
    		cin >> f >> t >> b;
    		A[++idx] = -t, B[idx] = b + t * f;
    		qs[i] = {1, idx};
		} else {
			cin >> op;
			qs[i] = {-1, op};
		}
    }

    for (int i = 1; i <= idx; ++i) {
        if (A[i] < 0)
            A[i] = -A[i], B[i] = -B[i];

        if (A[i])
            val[++cnt] = -(ldb)B[i] / A[i];
    }

    sort(val + 1, val + 1 + cnt);
    cnt = unique(val + 1, val + 1 + cnt) - val - 1;

	cout << fixed << setprecision(10);
    for (int i = 1; i <= n; ++i) {
    	int x = qs[i].i, f = qs[i].op;
    	
        if (A[x]) {
            int p = lower_bound(val + 1, val + 1 + cnt, -(ldb)B[x] / A[x]) - val;
            siz.update(1, -A[x] * f), siz.update(p + 1, 2 * A[x] * f);
            sum.update(1, -B[x] * f), sum.update(p + 1, 2 * B[x] * f);
        } else {
            sum.update(1, (B[x] < 0 ? -B[x] : B[x]) * f);
        }
        
        int p = siz.findBreak();
        cout << val[p] * siz.query(p) + sum.query(p) << '\n';
    }
}
